ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
EDMA.c File Reference

Enhanced Direct Memory Access driver. More...

#include "derivative.h"
#include "edma.h"

Functions

void vfnDMASet (uint8_t u8Chan, uint8_t *pu8DestAddr, uint8_t *pu8SourceAddr, uint16_t u16NOfBytes)
 This function will configure a pre-configured channel for Data transmission in a byte-by-byte manner.
void vfnDMAConfig (TCD_t *ptMyTCD, uint8_t u8Channel)
 This function will configure a channel for DMA action.
void vfnDMAStart (const uint8_t u8Chan)
 This function will Start a DMA loop.
void vfnDMAEnable (const uint8_t u8Chan)
 This function will enable a DMA channel.
uint8_t u8fnDMAPending (const uint8_t u8Chan)
 This function will return a 1 when a DMA transfer is done.
void vfnDMACopyArray (uint8_t *pu8Source, uint8_t *pu8Target, uint16_t u16Size, uint8_t u8Channel)
 Copies an array to a different location using eDMA.
uint8_t u8fnWaitForDMA (uint8_t u8Channel)
 Waits for a major loop of a given channel to expire.
uint8_t u8fnDMAReturnChannelStatus (uint8_t u8Channel)
 Returns the status for a given channel.
void vfnDMAMUXInit (uint8_t u8DMACh, uint8_t u8DMAMuxSource, uint8_t u8Trigger, uint8_t u8Enable)
 Routes a DMAMux channel to the right trigger.
void vfnDMAMuxEnable (uint8_t u8DMACh, uint8_t u8Enable)
 Enables a particular DMAMux channel that has already been configured through vfnDMAMUXInit.
uint8_t u8fnDMAMuxChEnStatus (uint8_t u8DMACh)
 Tells the caller whether a particular DMA channel is enabled or not.

Variables

const uint32_t cu32DMACopyArrayTCD []

Detailed Description

Enhanced Direct Memory Access driver.

Copyright (c) 2011 Freescale Semiconductor Freescale Confidential Proprietary

Author:
Freescale Semiconductor
SASD Automotive
R11515
Version:
Date:
Warning:
(If needed)

History:


Function Documentation

uint8_t u8fnDMAMuxChEnStatus ( uint8_t  u8DMACh)

Tells the caller whether a particular DMA channel is enabled or not.

Parameters:
u8DMACh,:eDMA (0 - 15).
Returns:
1 if enabled, zero if disabled.
uint8_t u8fnDMAPending ( const uint8_t  u8Chan)

This function will return a 1 when a DMA transfer is done.

Parameters:
u8Chan,:Channel to be used (0 - 15)
Returns:
1 when done, 0 otherwise.
uint8_t u8fnDMAReturnChannelStatus ( uint8_t  u8Channel)

Returns the status for a given channel.

Parameters:
u8Channel,:eDMA (0 - 15).
Returns:
Status as defined by DMA_CHANNEL_STATE.
uint8_t u8fnWaitForDMA ( uint8_t  u8Channel)

Waits for a major loop of a given channel to expire.

Parameters:
u8Channel,:eDMA (0 - 15).
Returns:
0 when the DMA copy has been completed, 1 when the function has timed-out.
void vfnDMAConfig ( TCD_t *  ptMyTCD,
uint8_t  u8Channel 
)

This function will configure a channel for DMA action.

Parameters:
ptMyTCD,:Settings for TCD (refer to TCD_t)
u8Chan,:Channel to be used (0 - 15)
Returns:
Void
void vfnDMACopyArray ( uint8_t *  pu8Source,
uint8_t *  pu8Target,
uint16_t  u16Size,
uint8_t  u8Channel 
)

Copies an array to a different location using eDMA.

Parameters:
pu8Source,:Pointer to initial element to copy
pu8Target,:Pointer to initial element to where to copy
u16NOfBytes,:Size in bytes of stream to copy
u8Channel,:eDMA (0 - 15) to use for copy.
Returns:
void.
void vfnDMAEnable ( const uint8_t  u8Chan)

This function will enable a DMA channel.

Parameters:
u8Chan,:Channel to be used (0 - 15)
Returns:
Void
void vfnDMAMuxEnable ( uint8_t  u8DMACh,
uint8_t  u8Enable 
)

Enables a particular DMAMux channel that has already been configured through vfnDMAMUXInit.

Parameters:
u8DMACh,:eDMA (0 - 15).
Returns:
Void.
void vfnDMAMUXInit ( uint8_t  u8DMACh,
uint8_t  u8DMAMuxSource,
uint8_t  u8Trigger,
uint8_t  u8Enable 
)

Routes a DMAMux channel to the right trigger.

Parameters:
u8DMACh,:eDMA (0 - 15).
u8DMAMuxSource,:DMA source as listed in DMA_MUX_SOURCES.
u8Trigger,:non-zero for enable, zero for disable. This variable allows the DMA Mux to be triggered through a PIT channel.
u8Enable,:non-zero to enable the DMA Mux right away, zero to disable.
Returns:
Void.
void vfnDMASet ( uint8_t  u8Chan,
uint8_t *  pu8DestAddr,
uint8_t *  pu8SourceAddr,
uint16_t  u16NOfBytes 
)

This function will configure a pre-configured channel for Data transmission in a byte-by-byte manner.

Parameters:
u8Chan,:Channel to be used (0 - 15)
pu8DestAddr,:Where data will be copied to.
pu8SourceAddr,:Where data comes from
u16NOfBytes,:Self-explanatory.
Returns:
Void
void vfnDMAStart ( const uint8_t  u8Chan)

This function will Start a DMA loop.

Parameters:
u8Chan,:Channel to be used (0 - 15)
Returns:
Void

Variable Documentation

const uint32_t cu32DMACopyArrayTCD[]
Initial value:
{
  (uint32_t)CLEAR, 
  (DMA_8_BIT_SOURCE | DMA_8_BIT_TARGET | DMA_OFFSET(1u)),
  (uint32_t)CLEAR, 
  (uint32_t)CLEAR, 
  (uint32_t)CLEAR,
  (CHANNEL_TO_CHANNEL_LINKING_ON_MINOR_LOOP_DIS | CURRENT_MAJOR_ITERATION(1u)
      | DMA_OFFSET(1u)), 
  (uint32_t)CLEAR,
  (CHANNEL_TO_CHANNEL_LINKING_ON_MAJOR_LOOP_DIS
      | NUMBER_OF_MAJOR_ITERATIONS(1u) | DONT_STALL_DMA | DMA_ISR_WHEN_DONE) }

Following array is used as default settings for copying an array from one point to another. Ironically, it must be copied through a loop.